home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / basic / mildred / mildred.lha / lha / MiniMildred.lha / makedeflibs.ascii < prev    next >
Text File  |  1998-11-18  |  1KB  |  64 lines

  1. DEFTYPE.l
  2. WBStartup
  3. ;
  4. ;program to create a 'blitz2:deflibs' file based on 'blitzlibs:#?/' libs
  5. ;
  6. If WriteFile(0,"blitz2:deflibs")=0
  7.   NPrint "Error creating blitz2:deflibs":End
  8. EndIf
  9. ;
  10. l.l=Lock_("blitzlibs:",-2)
  11. If l=0
  12.   NPrint "Error 'locking' blitzlibs:":End
  13. EndIf
  14. ;
  15. e.l=AllocMem_(260,1)
  16. e2.l=AllocMem_(260,1)
  17. ;
  18. Examine_ l,e
  19. ;
  20. While ExNext_(l,e)
  21.   If Peek.l(e+4)>=0  ;dir ?
  22.     d$="blitzlibs:"+Peek$(e+8)
  23.     l2=Lock_(&d$,-2)
  24.     If l2=0
  25.       NPrint "Error 'locking' ",d$:UnLock_ l:CloseFile 0:KillFile "blitz2:deflibs"
  26.       Goto freemem
  27.     EndIf
  28.     NPrint "":NPrint "Scanning directory : ",d$:NPrint ""
  29.     Examine_ l2,e2
  30.     While ExNext_(l2,e2)
  31.       If Peek.l(e2+4)<0   ;file?
  32.         f$=LCase$(Peek$(e2+8))
  33.         If Right$(f$,5)<>".info"
  34.           f$=d$+"/"+f$
  35.           If ReadFile(1,f$)
  36.             NPrint "Converting library : ",f$
  37.             FileInput 1:FileOutput 0
  38.             Print Mkl$(Lof(1))
  39. ;            Print Inkey$(Lof(1))
  40. InitBank 0,Lof(1),1
  41. ReadMem 1,Bank(0),Lof(1)
  42. WriteMem 0,Bank(0),Lof(1)
  43.             CloseFile 1:DefaultOutput
  44.           Else
  45.             NPrint "Error reading file ",f$
  46.             UnLock_ l:UnLock_ l2:CloseFile 0:KillFile "blitz2:deflibs"
  47.             Goto freemem
  48.           EndIf
  49.         EndIf
  50.       EndIf
  51.     Wend
  52.     UnLock_ l2
  53.   EndIf
  54. Wend
  55. FileOutput 0:Print Mkl$(0):DefaultOutput
  56. UnLock_ l
  57.  
  58. CloseFile 0
  59.  
  60. freemem:FreeMem_ e,260:FreeMem_ e2,260
  61.  
  62. End
  63.  
  64.